import request from './request.js'

const http = {
    get(url: string, params?: object, headers?: object) {
        const config = {
            method: 'GET',
            url: url,
            params: params ? params : {},
            headers: headers ? headers : {}
        }
        return request(config);
    },
    post(url: string, data?: object, headers?: object) {
        const config = {
            method: 'POST',
            url: url,
            data: data ? data : {},
            headers: headers ? headers : {}
        }
        return request(config);
    },
    put(url: string, data?: object, headers?: object) {
        const config = {
            method: 'PUT',
            url: url,
            data: data ? data : {},
            headers: headers ? headers : {}
        }
        return request(config)
    },
    delete(url: string, data?: object, headers?: object) {
        const config = {
            method: 'DELETE',
            url: url,
            data: data ? data : {},
            headers: headers ? headers : {}
        }
        return request(config)
    },
}
export default http